<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('项目跟踪查询')" />
	<th:block th:include="include :: list-css" />
	<style type="text/css">
		.layui-tab-content{border: 1px solid;padding: 10px 15px;}
		.layui-tab-title li{font-weight:600}
		.layui-tab{margin:0}
	</style>
</head>
<body>
<div class="mid-content">
	<div class="layui-tab" lay-filter="dhtab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" listUrl="/business/projectadded/list" listName="项目报备">项目报备</li>
	    <li listUrl="/business/offerprice/list" listName="销售报价">销售报价</li>
	    <li listUrl="/business/bargainin/list" listName="销售合同">销售合同</li>
	    <li listUrl="/business/orderprocess/list" listName="采购合同">采购合同</li>
	    <li listUrl="/business/gatheringbargain/list" listName="销售出库">销售出库</li>
	    <li listUrl="/business/out/list" listName="直发出库">直发出库</li>
	    <li listUrl="/business/invoiceout/list" listName="销售开票">销售开票</li>
	    <li listUrl="/business/expenseaccount/list" listName="费用报销">项目费用</li>
	    <li listUrl="/business/materialrequisition/list" listName="领料单">领料</li>
	    <li listUrl="/business/returnsheet/list" listName="退料单">退料</li>
	    <li listUrl="/business/installrecord/list" listName="设备安装验收记录">设备安装验收记录</li>
	    <li listUrl="/business/installstatecheck/list" listName="现场安装情况调查表">现场安装情况调查表</li>
	    <li listUrl="/business/patrolrecord/list" listName="UPS巡检记录单">UPS巡检记录单</li>
	    <li listUrl="/business/receivingreport/list" listName="UPS调试验收报告单">UPS调试验收报告单</li>
	    <li listUrl="/business/serveroffer/list" listName="服务报价单">服务报价单</li>
	    <li listUrl="/business/dailydiary/list" listName="实施日志">实施日志</li>
	    <li listUrl="/business/completionreceipt/list" listName="完工签收单">完工签收单</li>
	    <li listUrl="/business/repairrecord/list" listName="UPS维修记录单">UPS维修记录单</li>
	    <li listUrl="/business/testrunrecord/list" listName="试运行记录">试运行记录</li>
	  </ul>
	  <div class="layui-tab-content">
	    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
	  </div>
	</div>
</div>
 <script type="text/html" id="templet_effectStock">
{{# if(d.effectStock){ }}
	是
{{# }else{ }}
	否
{{# } }}
</script>
<th:block th:include="include :: footer" />
<th:block th:include="include :: businessJS" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + [[${prefix}]],
		bid=[[${bid}]],
		gridColumns=[[${gridColumns}]],
		business=[[${business}]];
	/*]]>*/
</script>
<script type="text/javascript">
var gridBodyMap=[],vXmBm;//表格列集合
$(".layui-tab-content").css("border-color",pellucidityTen)
gridBodyMap[0]=gridColumns.gridBody;//项目报备
gridBodyMap[1]=[//销售报价
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "vMan", title: "客户联系人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 100, sort: true, field: "fSumje", title: "报价金额", totalRow: true},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidNameName", title: "所属单位"}
	]
gridBodyMap[2]=[//销售合同
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "vMan", title: "客户联系人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "fSumje", title: "合同金额"},
	{width: 150, sort: true, field: "fXsFpsl", title: "销售税率"},
	{width: 150, sort: true, field: "fCkSl", title: "出库数量", totalRow: true},
	{width: 150, sort: true, title: "未出库数量", totalRow: true,templet: function(d){return d.bNumb-d.fCkSl}},
	{width: 150, sort: true, field: "fThSl", title: "退货数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl", title: "开票数量", totalRow: true},
	{width: 150, sort: true, field: "fKpSl2", title: "开票保存数量", totalRow: true},
	{width: 150, sort: true, title: "未开票数量", totalRow: true,templet: function(d){return d.bNumb-d.fKpSl-d.fThSl}},
	{width: 150, sort: true, field: "fDkJe", title: "到款金额", totalRow: true},
	{width: 150, sort: true, field: "fDkJe2", title: "到款保存金额", totalRow: true},
	{width: 150, sort: true, field: "fDkBl", title: "到款比例", totalRow: true},
	{width: 150, sort: true, field: "fZbj", title: "质保金"},
	{width: 150, sort: true, field: "dZbQx", title: "质保期限"},
	{width: 150, sort: true, field: "vFkFsName", title: "付款方式"},
	{width: 150, sort: true, field: "vXsLxName", title: "销售类型"},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[3]=[//采购合同
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gPName", title: "供应商名称"},
	{width: 150, sort: true, field: "vPMan", title: "供应商联系人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "fSumje", title: "采购金额"},
	{width: 150, sort: true, field: "fCgFpSl", title: "采购税率"},
	{width: 150, sort: true, field: "fZbj", title: "质保金"},
	{width: 150, sort: true, field: "dZbQx", title: "质保期限"},
	{width: 150, sort: true, field: "vFkFs", title: "付款方式"},
	{width: 150, sort: true, field: "pUser", title: "采购员"},
	{width: 150, sort: true, field: "pDept", title: "采购部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[4]=[//销售出库
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "vMan", title: "收货人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "fSumje", title: "出库金额"},
	{width: 150, sort: true, field: "gDepot", title: "出库仓库"},
	{width: 150, sort: true, field: "vFhFs", title: "发货方式"},
	{width: 150, sort: true, field: "vFhWl", title: "发货物流"},
	{width: 150, sort: true, field: "vTel", title: "收货电话"},
	{width: 150, sort: true, field: "vHyDh", title: "货运单号"},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[5]=[//直发出库
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "vMan", title: "收货人"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "fSumje", title: "出库金额"},
	{width: 150, sort: true, field: "gDepot", title: "出库仓库"},
	{width: 150, sort: true, field: "vFhFs", title: "发货方式"},
	{width: 150, sort: true, field: "vFhWl", title: "发货物流"},
	{width: 150, sort: true, field: "vTel", title: "收货电话"},
	{width: 150, sort: true, field: "vHyDh", title: "货运单号"},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[6]=[//销售开票
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gCName", title: "客户名称"},
	{width: 150, sort: true, field: "bNumb", title: "数量"},
	{width: 150, sort: true, field: "vMan", title: "收票人"},
	{width: 150, sort: true, field: "fSumje", title: "开票金额"},
	{width: 150, sort: true, field: "dKpRq", title: "开票日期"},
	{width: 150, sort: true, field: "vFpHm", title: "发票号码"},
	{width: 150, sort: true, field: "vFpLx", title: "发票类型"},
	{width: 150, sort: true, field: "dJpRq", title: "寄票日期"},
	{width: 150, sort: true, field: "vKdDh", title: "快递单号"},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"}
	]
gridBodyMap[7]=[//费用报销
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "fSumje", title: "报销金额", totalRow: true},
	{width: 150, sort: true, field: "gUserName", title: "销售员"},
	{width: 150, sort: true, field: "gDeptName", title: "销售部门"},
	{width: 150, sort: true, field: "cidName", title: "所属单位"},
	]
gridBodyMap[8]=[//领料单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 150, sort: true, field: "gID", title: "型号"},
	{width: 150, sort: true, field: "gName", title: "品名"},
	{width: 150, sort: true, field: "gModel", title: "规格"},
	{width: 150, sort: true, field: "gUnit", title: "单位"},
	{width: 150, sort: true, field: "bNumb", title: "领料数量"},
	{width: 150, sort: true, field: "bPrice", title: "库存单价"},
	{width: 150, sort: true, field: "fSumje", title: "领料金额"},
	{width: 150, sort: true, field: "gDepotName", title: "存货仓库"}
	
	]
gridBodyMap[9]=[//退料单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "gBrand", title: "品牌"},
	{width: 150, sort: true, field: "gID", title: "型号"},
	{width: 150, sort: true, field: "gName", title: "品名"},
	{width: 150, sort: true, field: "gModel", title: "规格"},
	{width: 150, sort: true, field: "gUnit", title: "单位"},
	{width: 150, sort: true, field: "bNumb", title: "退料数量"},
	{width: 150, sort: true, field: "bPrice", title: "库存单价"},
	{width: 150, sort: true, field: "fSumje", title: "领料金额"},
	{width: 150, sort: true, field: "gDepotName", title: "存货仓库"}
	]
gridBodyMap[10]=[//设备安装验收记录
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "nid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[11]=[//现场安装情况调查表
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[12]=[//UPS巡检记录单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[13]=[//UPS调试验收报告单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[14]=[//服务报价单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[15]=[//实施日志
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[16]=[//完工签收单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[17]=[//UPS维修记录单
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
gridBodyMap[18]=[//试运行记录
	{fixed: "left", width: 40,type: "numbers"},
	{width: 150, sort: true, field: "bid", title: "单据编号"},
	{width: 150, sort: true, field: "bUserName", title: "制单人"},
	{width: 150, sort: true, field: "bDeptName", title: "制单部门"},
	{width: 150, sort: true, field: "createTime", title: "创建日期"},
	{width: 150, sort: true, field: "effectStock", title: "是否确认",templet:"#templet_effectStock"}
	]
var $,layer,form,element,table,wherestr={};
layui.use(['table','form','layer','jquery','element'], function () {
    $ = layui.$, layer = layui.layer, form = layui.form, table = layui.table, element = layui.element;
    $.tablelist.init({//默认加载合同明细
        elem: '#dhtable'
        ,url: prefix + '/list'
   	 	,where: {'bid':bid}
    	,even:true
        ,totalRow: true
        ,cols:[gridBodyMap[0]
	 	]
		,height:'full-100'
		,done:function(){
			vXmBm=table.cache.dhtable[0].vXmBm;
		}
    });
	//监听排序事件 
    table.on('sort(ftable)', function(obj){
    	$.tablelist.sort('dhtable',obj);
    });
  	//双击行事件：查看单据
	table.on('rowDouble(ftable)', function(obj){
		var tabThis=$('.layui-tab-title').find('.layui-this'),//获取当前选中tab页dom节点
			tName=tabThis.attr('listName'),
			tUrl=tabThis.attr('listUrl');
		if(tName)parent.layui.index.openTabsPage(tUrl.replace('/group','').replace('list','edit?nid=')+obj.data.nid, tName+'('+obj.data.bid+')');
    });
	//监听Tab页
 	element.on('tab(dhtab)', function(data){
 		$.tablelist.init({//表格需重新初始化，重载会继承初始化的参数（不可行）
 			elem: '#dhtable',
 			url:$(this).attr('listUrl'),
 			even:true,
 			where:{'vXmBm':vXmBm},
 	        height:'full-100',
 	       	totalRow: true,
			cols:[gridBodyMap[data.index]
			]
 		});
	});
 });
</script>
</body>
</html>